home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
MAC OS 8
/
cmm-framework-10.sit
/
Trygve's CMM Framework 1.0
/
Sample Plugin (text beeper)
/
Plugin.cp
next >
Wrap
Text File
|
1997-08-28
|
2KB
|
73 lines
//
// Copyright ゥ1997 by Trygve Isaacson. All Rights Reserved.
//
// Additional Restrictions:
//
// Permission granted to:
// - Compile this source code.
// - Modify this source code, but not to remove this copyright information.
// - Freely distribute the compiled object form of this source code, and any
// modifications you make, in your programs.
//
// Permission NOT granted to:
// - Redistribute modified versions of this source code.
//
// You grant Trygve Isaacson one single-user license to your plugins based
// on this source code, and notify him at:
// trygve@bombaydigital.com
//
#include "Plugin.h"
#undef Inherited
#define Inherited PluginBase
#define kBeepCommand 0
Plugin::Plugin()
{
}
Plugin::~Plugin()
{
}
/*
Since we are just processing FSSpec items, we can use this method to filter out
unwanted files based on the file type. We only want 'TEXT' files, but we don't
care about the creator.
*/
Boolean Plugin::IsDesiredFSSpec(const FSSpec* aFileSpec, SInt32 /*commandID*/, Boolean /*isExaminePhase*/)
{
return this->IsSpecificCreatorType(aFileSpec, '****', 'TEXT');
}
/*
This plugin just beeps once for each selected file. The default behavior of the
plugin base class is to process typeFSS data, and we override above to filter
out non-TEXT files.
So if ANY of the data matched our criteria, we add a single Beep command to the menu.
*/
Boolean Plugin::AddMultiDataTypeCommand(AEDescList* commandList, UInt32 /*numDataTypes*/, OSType* /*dataTypesArray*/, UInt32 numDataTypesFound)
{
if (numDataTypesFound > 0)
this->AddCommand(commandList, "¥pBeep", kBeepCommand);
return true; // true means do NOT call AddDataTypeCommand for individual data types
}
/*
This is the first place in the calling sequence where we can process a selected item.
This will be called for each text file in the selection. We beep.
*/
OSStatus Plugin::ProcessSelectionItem(AEDesc* /*coercedDescriptor*/, SInt32 /*commandID*/)
{
::SysBeep(5);
return noErr;
}